package com.myself.chatbyvideo.model;

/**
 * @author 杜宇康
 * @create 2020—10-04 11:01
 */

public class Message {
    String type;
    String to;
    String room;
    String from;

    public Message(String type, String to, String room, String from) {
        this.type = type;
        this.to = to;
        this.room = room;
        this.from = from;
    }

    public Message() {
    }

    @Override
    public String toString() {
        return "Message{" +
                "type='" + type + '\'' +
                ", to='" + to + '\'' +
                ", room='" + room + '\'' +
                ", from='" + from + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Message message = (Message) o;

        if (!type.equals(message.type)) return false;
        if (!to.equals(message.to)) return false;
        if (!room.equals(message.room)) return false;
        return from.equals(message.from);
    }

    @Override
    public int hashCode() {
        int result = type.hashCode();
        result = 31 * result + to.hashCode();
        result = 31 * result + room.hashCode();
        result = 31 * result + from.hashCode();
        return result;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getTo() {
        return to;
    }

    public void setTo(String to) {
        this.to = to;
    }

    public String getRoom() {
        return room;
    }

    public void setRoom(String room) {
        this.room = room;
    }

    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }
}
